1

00:00:00,420  -->  00:00:04,540
In the previous video, we alredy create a
device models.

2

00:00:04,620  -->  00:00:13,420
Now, in this video, we are going to creat a device list menu. This menu will display all of devices from the database.

3

00:00:13,760  -->  00:00:21,520
Okay let’s just start. Open the visual studio
code. First we need to create a new url.

4

00:00:21,520  -->  00:00:25,320
Open the urls.py file inside our app.

5

00:00:27,360  -->  00:00:32,620
Here let’s create a new url, let’s say devices.

6

00:00:33,780  -->  00:00:39,240
This url will be redirected to devices function
inside views.

7

00:00:40,340  -->  00:00:45,080
Next, we need to create device function inside
views.py.

8

00:00:56,120  -->  00:01:00,860
We need to create a variable to save all devices from the database.

9

00:01:09,380  -->  00:01:12,280
Let’s use this variable as a context.

10

00:01:21,920  -->  00:01:25,760
We will return a template file devices.html,

11

00:01:30,240  -->  00:01:32,360
and don’t forget to use the context

12

00:01:32,380  -->  00:01:34,320
in the return statement.

13

00:01:36,100  -->  00:01:45,780
Last, we need to create a devices.html file. I already upload devices.html file in the resource section.

14

00:01:45,800  -->  00:01:51,380
So you can just download
it and put the file to the template directory.

15

00:01:53,820  -->  00:02:02,060
Okay now we have devices.html in the templates
directory. Let’s understand the code here.

16

00:02:02,120  -->  00:02:09,780
First we extend from base.html. In the block
content, we have a table.

17

00:02:11,320  -->  00:02:17,200
We have a looping statement here. We need
to change this variable with our context,

18

00:02:17,200  -->  00:02:25,460
in this case, the name of our context is all_device.
Here we display ip address, hostname, and

19

00:02:25,460  -->  00:02:27,540
vendor of each device.

20

00:02:28,080  -->  00:02:36,960
Let’s go to the browser, navigate to 127.0.0.1:8000/devices.

21

00:02:38,300  -->  00:02:44,740
Here we can see that we have successfully get the list of device from the database.

22

00:02:44,740  -->  00:02:48,940
To make sure, let’s create 1 new device
in the database.

23

00:03:03,580  -->  00:03:07,680
Let’s back to the device list menu, refresh.

24

00:03:08,840  -->  00:03:14,420
And here we are ! Now we
can see 1 new device that we just created.

25

00:03:14,420  -->  00:03:18,260
This is mean that our device list menu is
work!

26

00:03:18,420  -->  00:03:24,620
This is the end of this video, in the next
video, we are going to create a Configure Menu

27

00:03:24,760  -->  00:03:27,940
Thankyou for watching and see you on
the next video!
